{% load static %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理系统 - 现代智能收银系统</title>
    <!-- 引入Bootstrap CSS（本地静态文件） -->
    <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
    <!-- 引入Font Awesome（CDN） -->
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <!-- 自定义CSS -->
    <style>
        body {
            background-color: #f8f9fa;
            min-height: 100vh;
        }
        /* 侧边栏样式 */
        .sidebar {
            height: 100vh;
            background-color: #2c3e50;
            color: white;
            position: fixed;
            top: 0;
            left: 0;
            width: 250px;
            z-index: 1000;
            transition: all 0.3s ease;
        }
        .sidebar-header {
            padding: 1.5rem;
            background-color: #1a252f;
            text-align: center;
        }
        .sidebar-header h1 {
            margin: 0;
            font-size: 1.5rem;
        }
        .nav-link {
            color: rgba(255, 255, 255, 0.8);
            padding: 1rem 1.5rem;
            display: flex;
            align-items: center;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            transition: all 0.3s ease;
        }
        .nav-link:hover {
            color: white;
            background-color: #34495e;
            text-decoration: none;
        }
        .nav-link i {
            margin-right: 1rem;
        }
        .nav-link.active {
            background-color: #007bff;
            color: white;
        }
        /* 主内容区样式 */
        .main-content {
            margin-left: 250px;
            transition: all 0.3s ease;
        }
        .header {
            background-color: white;
            padding: 1rem 2rem;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .header h2 {
            margin: 0;
            font-size: 1.5rem;
            color: #2c3e50;
        }
        .user-info {
            display: flex;
            align-items: center;
        }
        .user-info img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 0.75rem;
        }
        .user-info span {
            color: #2c3e50;
            font-weight: 500;
        }
        .content {
            padding: 2rem;
        }
        /* 卡片样式 */
        .dashboard-card {
            border-radius: 8px;
            box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
            transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
        }
        .dashboard-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        }
        .card-icon {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            margin-right: 1rem;
        }
        .card-title {
            font-size: 1rem;
            color: #6c757d;
            margin-bottom: 0.25rem;
        }
        .card-value {
            font-size: 1.5rem;
            font-weight: bold;
            color: #2c3e50;
        }
        /* 数据表格样式 */
        .data-table {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
            overflow: hidden;
        }
        .data-table th {
            background-color: #f8f9fa;
            font-weight: 600;
            color: #495057;
        }
        .data-table td {
            vertical-align: middle;
        }
        .badge {
            padding: 0.35em 0.65em;
            font-size: 0.75em;
            font-weight: 500;
            border-radius: 0.375rem;
        }
        /* 响应式调整 */
        @media (max-width: 992px) {
            .sidebar {
                width: 80px;
            }
            .sidebar-header h1 {
                display: none;
            }
            .nav-link span {
                display: none;
            }
            .nav-link i {
                margin-right: 0;
            }
            .main-content {
                margin-left: 80px;
            }
        }
        @media (max-width: 576px) {
            .header h2 {
                font-size: 1.25rem;
            }
            .content {
                padding: 1rem;
            }
        }
    </style>
</head>
<body>
    <!-- 侧边栏 -->
    <div class="sidebar">
        <div class="sidebar-header">
            <h1><i class="fa fa-shield"></i> 管理系统</h1>
        </div>
        <nav class="nav flex-column">
            <a href="{% url 'backend_home' %}" class="nav-link active"><i class="fa fa-home"></i> <span>仪表盘</span></a>
            <a href="#" class="nav-link"><i class="fa fa-users"></i> <span>用户管理</span></a>
            <a href="#" class="nav-link"><i class="fa fa-shopping-bag"></i> <span>商品管理</span></a>
            <a href="#" class="nav-link"><i class="fa fa-cart-plus"></i> <span>订单管理</span></a>
            <a href="#" class="nav-link"><i class="fa fa-cubes"></i> <span>库存管理</span></a>
            <a href="#" class="nav-link"><i class="fa fa-bar-chart"></i> <span>数据分析</span></a>
            <a href="#" class="nav-link"><i class="fa fa-cog"></i> <span>系统设置</span></a>
            <a href="#" class="nav-link"><i class="fa fa-question-circle"></i> <span>帮助中心</span></a>
        </nav>
    </div>
    
    <!-- 主内容区 -->
    <div class="main-content">
        <!-- 头部导航 -->
        <div class="header">
            <h2><i class="fa fa-dashboard"></i> 仪表盘</h2>
            <div class="user-info">
                <img src="{% static 'img/user-avatar.png' %}" alt="管理员头像">
                <span>管理员</span>
                <div class="dropdown ml-3">
                    <button class="btn btn-outline-secondary dropdown-toggle" type="button" id="adminMenu" data-bs-toggle="dropdown" aria-expanded="false">
                        <i class="fa fa-cog"></i>
                    </button>
                    <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="adminMenu">
                        <li><a class="dropdown-item" href="#"><i class="fa fa-user-circle"></i> 个人信息</a></li>
                        <li><a class="dropdown-item" href="#"><i class="fa fa-lock"></i> 修改密码</a></li>
                        <li><hr class="dropdown-divider"></li>
                        <li><a class="dropdown-item text-danger" href="#"><i class="fa fa-sign-out"></i> 退出登录</a></li>
                    </ul>
                </div>
            </div>
        </div>
        
        <!-- 内容区域 -->
        <div class="content">
            <!-- 欢迎信息 -->
            <div class="mb-4">
                <h3>欢迎回来，管理员！</h3>
                <p class="text-muted">今天是 {% now "Y年n月j日" %}，这是您的系统概览。</p>
            </div>
            
            <!-- 数据卡片 -->
            <div class="row mb-4">
                <div class="col-md-3 mb-3">
                    <div class="dashboard-card card p-4">
                        <div class="d-flex align-items-center">
                            <div class="card-icon bg-primary text-white">
                                <i class="fa fa-users"></i>
                            </div>
                            <div>
                                <div class="card-title">注册用户</div>
                                <div class="card-value">1248</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-3 mb-3">
                    <div class="dashboard-card card p-4">
                        <div class="d-flex align-items-center">
                            <div class="card-icon bg-success text-white">
                                <i class="fa fa-shopping-bag"></i>
                            </div>
                            <div>
                                <div class="card-title">商品数量</div>
                                <div class="card-value">876</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-3 mb-3">
                    <div class="dashboard-card card p-4">
                        <div class="d-flex align-items-center">
                            <div class="card-icon bg-warning text-white">
                                <i class="fa fa-shopping-cart"></i>
                            </div>
                            <div>
                                <div class="card-title">今日订单</div>
                                <div class="card-value">156</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-3 mb-3">
                    <div class="dashboard-card card p-4">
                        <div class="d-flex align-items-center">
                            <div class="card-icon bg-danger text-white">
                                <i class="fa fa-money"></i>
                            </div>
                            <div>
                                <div class="card-title">今日收入</div>
                                <div class="card-value">¥12,856</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 图表和数据表格 -->
            <div class="row">
                <!-- 销售趋势图 -->
                <div class="col-md-6 mb-4">
                    <div class="data-table card">
                        <div class="card-header bg-white">
                            <h4 class="card-title mb-0"><i class="fa fa-line-chart"></i> 销售趋势</h4>
                        </div>
                        <div class="card-body">
                            <div style="height: 300px;">
                                <!-- 这里将放置图表，实际应用中使用Chart.js等图表库 -->
                                <div class="w-100 h-100 d-flex align-items-center justify-content-center">
                                    <div class="text-center">
                                        <i class="fa fa-area-chart fa-5x text-muted mb-3"></i>
                                        <p class="text-muted">销售趋势图表将在实际应用中实现</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 商品分类统计 -->
                <div class="col-md-6 mb-4">
                    <div class="data-table card">
                        <div class="card-header bg-white">
                            <h4 class="card-title mb-0"><i class="fa fa-pie-chart"></i> 商品分类统计</h4>
                        </div>
                        <div class="card-body">
                            <div style="height: 300px;">
                                <!-- 这里将放置图表，实际应用中使用Chart.js等图表库 -->
                                <div class="w-100 h-100 d-flex align-items-center justify-content-center">
                                    <div class="text-center">
                                        <i class="fa fa-pie-chart fa-5x text-muted mb-3"></i>
                                        <p class="text-muted">商品分类统计图表将在实际应用中实现</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 最近订单表格 -->
                <div class="col-12 mb-4">
                    <div class="data-table card">
                        <div class="card-header bg-white">
                            <div class="d-flex justify-content-between align-items-center">
                                <h4 class="card-title mb-0"><i class="fa fa-list-alt"></i> 最近订单</h4>
                                <a href="#" class="btn btn-primary btn-sm">查看全部</a>
                            </div>
                        </div>
                        <div class="card-body p-0">
                            <div class="table-responsive">
                                <table class="table mb-0">
                                    <thead>
                                        <tr>
                                            <th>订单号</th>
                                            <th>顾客</th>
                                            <th>商品数量</th>
                                            <th>订单金额</th>
                                            <th>支付方式</th>
                                            <th>订单状态</th>
                                            <th>下单时间</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>ORD-20231025-001</td>
                                            <td>张三</td>
                                            <td>3</td>
                                            <td>¥15.50</td>
                                            <td>微信支付</td>
                                            <td><span class="badge bg-success">已完成</span></td>
                                            <td>2023-10-25 15:30:45</td>
                                            <td>
                                                <a href="#" class="btn btn-info btn-sm mr-1"><i class="fa fa-eye"></i></a>
                                                <a href="#" class="btn btn-warning btn-sm"><i class="fa fa-edit"></i></a>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>ORD-20231025-002</td>
                                            <td>李四</td>
                                            <td>5</td>
                                            <td>¥32.00</td>
                                            <td>支付宝</td>
                                            <td><span class="badge bg-success">已完成</span></td>
                                            <td>2023-10-25 15:25:18</td>
                                            <td>
                                                <a href="#" class="btn btn-info btn-sm mr-1"><i class="fa fa-eye"></i></a>
                                                <a href="#" class="btn btn-warning btn-sm"><i class="fa fa-edit"></i></a>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>ORD-20231025-003</td>
                                            <td>王五</td>
                                            <td>2</td>
                                            <td>¥8.50</td>
                                            <td>现金</td>
                                            <td><span class="badge bg-success">已完成</span></td>
                                            <td>2023-10-25 15:20:36</td>
                                            <td>
                                                <a href="#" class="btn btn-info btn-sm mr-1"><i class="fa fa-eye"></i></a>
                                                <a href="#" class="btn btn-warning btn-sm"><i class="fa fa-edit"></i></a>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>ORD-20231025-004</td>
                                            <td>赵六</td>
                                            <td>4</td>
                                            <td>¥26.00</td>
                                            <td>银行卡</td>
                                            <td><span class="badge bg-warning">处理中</span></td>
                                            <td>2023-10-25 15:15:22</td>
                                            <td>
                                                <a href="#" class="btn btn-info btn-sm mr-1"><i class="fa fa-eye"></i></a>
                                                <a href="#" class="btn btn-warning btn-sm"><i class="fa fa-edit"></i></a>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>ORD-20231025-005</td>
                                            <td>钱七</td>
                                            <td>1</td>
                                            <td>¥4.50</td>
                                            <td>微信支付</td>
                                            <td><span class="badge bg-danger">已取消</span></td>
                                            <td>2023-10-25 15:10:08</td>
                                            <td>
                                                <a href="#" class="btn btn-info btn-sm mr-1"><i class="fa fa-eye"></i></a>
                                                <a href="#" class="btn btn-warning btn-sm"><i class="fa fa-edit"></i></a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 引入Bootstrap JS -->
    <script src="{% static 'js/bootstrap.bundle.min.js' %}"></script>
    <!-- 自定义脚本 -->
    <script>
        // 等待页面加载完成
        document.addEventListener('DOMContentLoaded', function() {
            // 模拟数据加载
            console.log('后台管理系统页面加载完成');
            
            // 侧边栏导航菜单高亮
            const navLinks = document.querySelectorAll('.nav-link');
            navLinks.forEach(link => {
                link.addEventListener('click', function() {
                    // 移除所有激活状态
                    navLinks.forEach(l => l.classList.remove('active'));
                    // 添加当前激活状态
                    this.classList.add('active');
                });
            });
            
            // 模拟图表数据加载
            // 在实际应用中，这里会加载Chart.js等图表库并渲染数据
            
            // 表格行悬停效果
            const tableRows = document.querySelectorAll('table tbody tr');
            tableRows.forEach(row => {
                row.addEventListener('mouseenter', function() {
                    this.style.backgroundColor = '#f8f9fa';
                });
                row.addEventListener('mouseleave', function() {
                    this.style.backgroundColor = '';
                });
            });
        });
    </script>
</body>
</html>